home *** CD-ROM | disk | FTP | other *** search
/ The Encyclicals & Post-Sy…ortations of John Paul 2 / The Encyclicals & Post-Synodal Apostolic Exhortations of John Paul 2.iso / pc / win / title.mst < prev    next >
Encoding:
Text File  |  1999-04-22  |  16.1 KB  |  490 lines

  1. '**************************************************************************
  2. '*
  3. '* TITLE.MST - Viewer Runtime Setup Script
  4. '*
  5. '* CUSTOMIZING TITLE.MST
  6. '*
  7. '* For a simple Setup routine, you just need to assign values to the 
  8. '* series of variables following the heading "Setup Variables". This
  9. '* script also provides for the following more-advanced options, which
  10. '* are supported by subroutines located later in this script:
  11. '*
  12. '* Option                                         See Subroutine
  13. '* ------------------------------------------     ---------------------
  14. '* Install more than one .MVB file                ModifyViewerIni
  15. '* Install Help title                             ModifyViewerIni
  16. '* Install custom DLLs                            ModifyViewerIni
  17. '* Install multiple Program Manager items         ModifyProgramManager
  18. '* Display a custom icon with the ProgMan item    ModifyProgramManager
  19. '* Install custom fonts                           RegisterCustomFonts
  20. '* Install Video for Windows runtime files        RegisterDrivers
  21. '*
  22. '* Each customization note starts with the heading CUSTOMIZATION.
  23. '*
  24. '**************************************************************************
  25.     
  26.     '' Global variables
  27.  
  28.     GLOBAL TitleShortName$
  29.     GLOBAL TitleLongName$
  30.     GLOBAL MVBFileName$
  31.     GLOBAL PromptForPath%
  32.     GLOBAL DefaultPath$
  33.     GLOBAL ProgManGroup$
  34.     GLOBAL ProgManItem$
  35.  
  36.     '' ****************************************************************
  37.     '' ** Setup Variables
  38.     '' ****************************************************************
  39.  
  40.     '' Set the following string to a short form of the title name
  41.     '' (for example, "Gallery")
  42.     
  43.     TitleShortName$ = "Encyclicals and Exhortations"
  44.     
  45.     '' Set the following string to a long form of the title name
  46.     '' (for example, "Viewer 2.0 Gallery")
  47.     
  48.     TitleLongName$ = "The Encyclicals and Exhortations of John Paul II on CD-ROM"
  49.         
  50.     '' Set the following variable to the name of the MVB file, without 
  51.     '' the filename extension (for example, "GALLERY")
  52.         
  53.     MVBFileName$ = "ENCYJPII"
  54.  
  55.     '' to specify a directory in which to install title files. (Files
  56.     '' to be installed on the hard disk must be listed in the TITLE.INF 
  57.     '' file under the [Installed Title Files] section.) Specify one of
  58.     '' the following values:
  59.     ''
  60.     '' 0    Install title files in the Windows directory (default setting).
  61.     ''      This is an appropriate setting if you have a limited number
  62.     ''      of files to copy (for example, a single custom icon or DLL).
  63.     ''
  64.     '' 1    Display a dialog box to prompt the user for a directory in 
  65.     ''      which to install files
  66.         
  67.     PromptForPath% = 1
  68.         
  69.     '' If you have specified 1 in PromptForPath%, set the following 
  70.     '' variable to the default path that will be displayed in the dialog
  71.     '' box (for example, "C:\GALLERY").
  72.         
  73.     DefaultPath$ = "C:\OSV"
  74.     
  75.     '' Set the following variable to the name of the program manager 
  76.     '' group you would like to create (for example, "Viewer 2.0 Gallery")
  77.         
  78.     ProgManGroup$ = "Our Sunday Visitor"
  79.     
  80.     '' Set the following variable to the caption of the program manager 
  81.     '' item for your title (for example, "Gallery")
  82.         
  83.     ProgManItem$ = "The Encyclicals and Exhortations of John Paul II"
  84.     
  85.     '***********************************************************************
  86.     '** Mainline
  87.     '***********************************************************************
  88.  
  89.     GLOBAL CUIDLL$
  90.  
  91.     '' Include files
  92.     '$INCLUDE 'setupapi.inc'
  93.     
  94.     '' Custom UI dll
  95.     CUIDLL$ = "mscuistf.dll"
  96.     
  97.     '' Dialog ID's
  98.     CONST DESTPATH      = 1000
  99.     CONST APPHELP       = 2000
  100.     CONST TOOBIG        = 3000
  101.     CONST BADPATH       = 4000
  102.     CONST SUCCESS       = 5000
  103.     
  104.     '' Bitmap ID
  105.     CONST LOGO = 1
  106.     
  107.     '' Functions and subroutines
  108.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  109.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  110.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  111.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  112.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  113.     DECLARE SUB ModifyViewerIni
  114.     DECLARE SUB RegisterCustomFonts
  115.     DECLARE SUB ModifyProgramManager(szTitleDir$)
  116.     DECLARE SUB ShowSuccess
  117.     DECLARE SUB RegisterDrivers
  118.     
  119.     '' The following statement turns size checking off. Set it to scmOnFatal 
  120.     '' to enable size checking, where Setup will compare the disk file size 
  121.     '' with the INF file size and report an error if they are not the same.
  122.     
  123.     i% = SetSizeCheckMode(scmOff)
  124.     
  125.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  126.     '' alter the banner bitmap.
  127.     
  128.     SetTitle "Encyclicals and Exhortations of John Paul Setup"
  129.     '' SetBitmap CUIDLL$, LOGO 
  130.     
  131.     '' Read in the INF file.
  132.     
  133.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  134.     
  135.     '' Decide where to put title files
  136.     IF PromptForPath% = 1 THEN
  137.         szTitleDir$ = GetTitleDir(DefaultPath$)
  138.         IF szTitleDir$ = "" THEN
  139.             GOTO QUIT
  140.         ENDIF
  141.     ELSE
  142.         szTitleDir$ = GetWindowsDir()
  143.     ENDIF   
  144.     
  145.     '' Copy files
  146.     IF CopyFiles(szTitleDir$) = 0 THEN
  147.         GOTO QUIT
  148.     ENDIF
  149.  
  150.     '' Create the MVIEWER2.EXE MVB association 
  151.     CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone
  152.  
  153.     '' Register in VIEWER.INI
  154.     ModifyViewerIni
  155.  
  156.     '' Register custom fonts
  157.     RegisterCustomFonts
  158.  
  159.     '' Register drivers
  160.     RegisterDrivers
  161.     
  162.     '' Modify Program Manager
  163.     ModifyProgramManager(szTitleDir$)
  164.     
  165.     '' Success dialog
  166.     ShowSuccess
  167.     
  168.     '' Now start the title
  169.  
  170.     RUN "mviewer2.exe " + MVBFileName$ + ".MVB"
  171.  
  172. QUIT:
  173.     
  174.     END
  175.     
  176.  
  177. '*************************************************************************
  178. '** Purpose:
  179. '**     Prompts the user for a path for the title files
  180. '** Arguments:
  181. '**     szDefault$ - default path
  182. '** Returns:
  183. '**     New valid path name, or "" if the user quit.
  184. '*************************************************************************
  185.  
  186. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  187.  
  188.     SetSymbolValue "String", TitleShortName$
  189.     SetSymbolValue "EditTextIn", szDefault$
  190.     SetSymbolValue "EditFocus", "ALL"
  191.  
  192.     GETPATH:
  193.  
  194.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  195.  
  196.     IF sz$ = "CONTINUE" THEN
  197.         szTitleDir$ = GetSymbolValue("EditTextOut")
  198.         IF IsDirWritable(szTitleDir$) = 0 THEN
  199.  
  200.             BADPATH:
  201.  
  202.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  203.             IF sz$ = "REACTIVATE" THEN
  204.                 GOTO BADPATH
  205.             END IF
  206.             UIPop 1
  207.             GOTO GETPATH
  208.         END IF
  209.         UIPop 1
  210.         CreateDir szTitleDir$, cmoNone
  211.  
  212.     ELSEIF sz$ = "REACTIVATE" THEN
  213.         GOTO GETPATH
  214.  
  215.     ELSE
  216.         szTitleDir$ = ""
  217.  
  218.     END IF
  219.  
  220.     GetTitleDir = szTitleDir$
  221.  
  222. END FUNCTION
  223.  
  224.  
  225. '*************************************************************************
  226. '** Purpose:
  227. '**     Copies the files in the INF file
  228. '** Arguments:
  229. '**     szTitleDir$ - destination directory for the title files
  230. '** Returns
  231. '**     1 if files were copied, 0 otherwise
  232. '*************************************************************************
  233.  
  234. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  235.  
  236.     '' Add all system files to the copy list
  237.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  238.     
  239.     '' Add all of the title files to the copy list
  240.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  241.     
  242.     '' Check size
  243.     szExtras$ = "Extra"
  244.     szCosts$ = "Costs"
  245.     szNeededs$ = "Neededs"
  246.     FOR i% = 1 TO 26 STEP 1
  247.         AddListItem szExtras$, "0"
  248.     NEXT i%
  249.     
  250.     '' We assume that VIEWER.INI will take another 4K
  251.     ReplaceListItem szExtras$, ASC(MID$(UCASE$(GetWindowsDir()), 1, 1)) - ASC("A") + 1, STR$(4096)
  252.     
  253.     '' Get amount of space required
  254.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  255.     
  256.     '' Put up a message if there is not enough space
  257.     FOR i% = 1 TO 26 STEP 1
  258.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  259.     
  260.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  261.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  262.     
  263.             TOOBIG:
  264.     
  265.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  266.             IF sz$ = "REACTIVATE" THEN
  267.                 GOTO TOOBIG
  268.             END IF
  269.             UIPop 1
  270.             CopyFiles = 0
  271.             GOTO DONTCOPY
  272.         END IF
  273.     NEXT i%
  274.     
  275.     '' Copy the files
  276.     CopyFilesInCopyList
  277.     
  278.     CopyFiles = 1
  279.  
  280. DONTCOPY:
  281.  
  282. END FUNCTION
  283.  
  284.  
  285. '*************************************************************************
  286. '** Purpose:
  287. '**     Puts up a success dialog
  288. '*************************************************************************
  289.  
  290. SUB ShowSuccess STATIC
  291.  
  292.     SUCCESS:
  293.     
  294.     SetSymbolValue "String1", TitleShortName$
  295.     sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
  296.     IF sz$ = "REACTIVATE" THEN
  297.         GOTO SUCCESS
  298.     END IF
  299.     UIPop 1
  300.     
  301. END SUB
  302.  
  303.  
  304. '*************************************************************************
  305. '** Purpose:
  306. '**     Appends a file name to the end of a directory path,
  307. '**     inserting a backslash character as needed.
  308. '** Arguments:
  309. '**     szDir$  - full directory path (with optional ending "\")
  310. '**     szFile$ - filename to append to directory
  311. '** Returns:
  312. '**     Resulting fully qualified path name.
  313. '*************************************************************************
  314.  
  315. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  316.     IF szDir$ = "" THEN
  317.         MakePath = szFile$
  318.     ELSEIF szFile$ = "" THEN
  319.         MakePath = szDir$
  320.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  321.         MakePath = szDir$ + szFile$
  322.     ELSE
  323.         MakePath = szDir$ + "\" + szFile$
  324.     END IF
  325. END FUNCTION
  326.  
  327.  
  328. '*************************************************************************
  329. '** Purpose:
  330. '**     Registers a font.
  331. '** Arguments:
  332. '**     fontfile$ - font filename
  333. '**     fontname$ - font name.
  334. '*************************************************************************
  335.  
  336. SUB RegisterFont(fontfile$, fontname$) STATIC
  337.  
  338.     '' A simple error catching wrapper around AddFont, which is a 'C' routine in MSCUISTF.DLL
  339.  
  340.     IF AddFont(fontfile$, fontname$) = -1 THEN
  341.         j% = DoMsgBox("Could not install " + fontfile$ + " font.", "Viewer Font Installation", 0)
  342.     ENDIF
  343.  
  344. END SUB
  345.  
  346.  
  347. '*************************************************************************
  348. '** Purpose:
  349. '**     Registers title in VIEWER.INI
  350. '*************************************************************************
  351.  
  352. SUB ModifyViewerIni STATIC
  353.  
  354.     IndexLongName$ = "The Encyclicals and Exhortations of John Paul II Index"
  355.     HelpLongName$ = "The Encyclicals and Exhortations of John Paul II Help"
  356.  
  357.     '' Get the VIEWER.INI file
  358.     
  359.     szIni$ = MakePath(GetWindowsDir(), "VIEWER.INI")
  360.  
  361.     '' First register the title file, setting the Name and Path entries. 
  362.     '' We assume that the MVB file is the same directory as SETUP.EXE.
  363.     ''
  364.     '' CUSTOMIZATION: If you're installing multiple MVB files, copy the
  365.     '' following two statements for each additional file, substituting
  366.     '' the appropriate long name and MVB filename for the TitleLongName$
  367.     '' and MVBFileName$ variables.
  368.     
  369.     CreateIniKeyValue szIni$, MVBFileName$, "Name", TitleLongName$, cmoOverwrite
  370.     CreateIniKeyValue szIni$, MVBFileName$, "Path", GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  371.     CreateIniKeyValue szIni$, "ENCYJPID", "Name", IndexLongName$, cmoOverwrite
  372.     CreateIniKeyValue szIni$, "ENCYJPID", "Path", GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  373.     CreateIniKeyValue szIni$, "ENCYJPHP", "Name", HelpLongName$, cmoOverwrite
  374.     CreateIniKeyValue szIni$, "ENCYJPHP", "Path", GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  375.  
  376.     '' Now we have to register the MVB file in the [FILES] section, so 
  377.     '' Viewer can find files that are not on the path and display a 
  378.     '' special message when a file is not found.
  379.  
  380.     CreateIniKeyValue szIni$, "FILES", MVBFileName$ + ".MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the " + TitleLongName$ + " disk.", cmoOverwrite
  381.     CreateIniKeyValue szIni$, "FILES", "ENCYJPID.MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the " + TitleLongName$ + " disk.", cmoOverwrite
  382.     CreateIniKeyValue szIni$, "FILES", "ENCYJPHP.MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the " + TitleLongName$ + " disk.", cmoOverwrite
  383.  
  384.     '' CUSTOMIZATION: If you're installing a Help title or any custom DLLs,
  385.     '' you should copy the preceding statement for each extra title or DLL.
  386.     ''
  387.     '' Example for installing an extra title:
  388.     ''
  389.     ''    CreateIniKeyValue szIni$, "FILES", "GALHELP.MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the Viewer 2.0 Gallery disk.", cmoOverwrite
  390.     ''
  391.     '' Example for installing a custom DLL:
  392.     ''
  393.     ''    CreateIniKeyValue szIni$, "FILES", "GALLERY.DLL", GetSymbolValue("STF_SRCDIR") + "," + "A required file is missing. Please reinstall the Viewer Gallery.", cmoOverwrite
  394.  
  395. END SUB
  396.  
  397.  
  398. '*************************************************************************
  399. '** Purpose:
  400. '**     Creates program manager entries for the title
  401. '*************************************************************************
  402.  
  403. SUB ModifyProgramManager(szTitleDir$) STATIC
  404.  
  405.     '' Create the program manager group
  406.  
  407.     CreateProgmanGroup ProgmanGroup$, "", cmoNone
  408.     ShowProgmanGroup ProgmanGroup$, 1, cmoNone
  409.     
  410.     '' Create an entry for the title
  411.      
  412. ''    CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".ICO"), cmoOverwrite
  413.     CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".MVB"), MakePath(szTitleDir$, MVBFileName$ + ".ICO"), cmoOverwrite
  414.  
  415.     '' CUSTOMIZATION: 
  416.     ''
  417.     '' To create additional Program Manager items, copy the preceding 
  418.     '' statement for each additional item, substituting the appropriate
  419.     '' name for the MVBFileName$ variable.
  420.     ''
  421.     '' To display a custom icon with the Program Manager item, specify
  422.     '' the icon filename with the fourth parameter (this parameter is 
  423.     '' currently an empty string, ""). The following example specifies 
  424.     '' an icon with the same filename as the .MVB file:
  425.     ''
  426.     ''       CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".ICO"), cmoOverwrite
  427.  
  428. END SUB
  429.  
  430.  
  431. '*************************************************************************
  432. '** Purpose:
  433. '**     Registers custom fonts with Windows.
  434. '*************************************************************************
  435.  
  436. SUB RegisterCustomFonts STATIC
  437.  
  438.     '' CUSTOMIZATION: If you install custom fonts, then add statements
  439.     '' in this routine to register the fonts with the current Windows 
  440.     '' session and to add them to the WIN.INI [Fonts] section. 
  441.     ''
  442.     '' Note that TrueType fonts can only be installed in Windows 3.1.
  443.     '' RegisterFont automatically creates the required .FOT file for 
  444.     '' TrueType fonts.
  445.     ''    
  446.     '' The following example registers a font residing in MISTRAL.TTF
  447.     '' and installs the font with the name Mistral (True Type):
  448.     '' 
  449.     ''     RegisterFont "mistral.ttf", "Mistral (TrueType)"
  450.     ''
  451.  
  452. END SUB
  453.  
  454.  
  455. '*************************************************************************
  456. '** Purpose:
  457. '**     Registers Windows drivers
  458. '*************************************************************************
  459.  
  460. SUB RegisterDrivers STATIC
  461.  
  462. '' CUSTOMIZATION: Video for Windows is not a standard component of
  463. '' Windows 3.1. If your title uses video, proceed as follows.
  464. ''
  465. '' 1) Add the following files to the [System Files] section of the INF file:
  466. ''
  467. ''    dispdib.dll
  468. ''    msvideo.dll
  469. ''    indeo.drv
  470. ''    mciavi.drv
  471. ''    msvidc.drv
  472. ''
  473. '' 2) Add the above files to your release directory. US versions can be 
  474. ''    found in the \SYSTEM subdirectory of your Viewer disc. French and
  475. ''    German versions were not available at ship time. Please contact 
  476. ''    Microsoft or check the Multimedia Viewer section on the Microsoft
  477. ''    Compuserve Forum for further details.
  478. ''
  479. '' 3) Uncomment the following lines:
  480. ''
  481. '' CreateIniKeyValue "WIN.INI", "mci extensions", "AVI", "AVIVIDEO", cmoNone
  482. '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "mci", "AVIVIDEO", "MCIAVI.DRV", cmoNone
  483. '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.msvc", "msvidc.drv", cmoNone
  484. '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.rt21", "indeo.drv", cmoNone
  485.  
  486. END SUB
  487.  
  488.  
  489.  
  490.